package cn.i96688.scanclient.barcode;

import cn.i96688.scanclient.exception.PayException;

/**
 * 条码消费者
 * @author xys
 *
 */
public class BarcodeConsumer {
	
	private static BarcodeConsumer consumer=new BarcodeConsumer();
	private ScanBarcodeListener listener;
	public static BarcodeConsumer getInstance(){
		return consumer;
	}
	private BarcodeConsumer(){
		
	}
	public void setScanBarcodeListener(ScanBarcodeListener l){
		listener=l;
	}
	public void consume(String barcode){
		if(listener==null){
			throw new PayException("扫码监听器配置出错");
		}else{
			listener.consume(barcode);
		}
	}
}
